//
//  Food.m
//  shise
//
//  Created by 毛志鹏 on 14/12/17.
//  Copyright (c) 2014年 MZP. All rights reserved.
//

#import "Food.h"

@implementation Food
-(void)dealloc
{
    [_type release];
    [_objId release];
    [_pic_url release];
    [_likeCount release];
    [_userName release];
    [_content release];
    [_location release];
    [_desc release];
    [_user release];
    [_userId release];
    [_level release];
    [_date release];
    [_moreApi release];
    [_menuOne release];
    [_menuTwo release];
    [_center release];
    [_url release];
    [_webViewUrlOne release];
    [_webViewUrlTwo release];
    [_subTitle release];
    [_detailApiOne release];
    [_detailApiTwo release];
    [_userHeadeImageViewAddress release];
    [_currentUserName release];
    [super dealloc];
    
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"pic"]) {
        self.pic_url = [value objectForKey:@"url"];
    } else if ([key isEqualToString:@"title"]) {
        self.userName = value;

    } else if ([key isEqualToString:@"detail"]) {
        
        // 添加的纠错方法 更多界面的cell中的图片点击之后到详情界面需要API（许国庆添加）
        self.objId = [value objectForKey:@"api"];
//        NSLog(@"%@", self.objId);
    } else if ([ key isEqualToString:@"cards"]){
        
        NSArray *array = value;
//        NSDictionary *dic = [array objectAtIndex:0];
//        NSDictionary *tempDic = [dic objectForKey:@"pic"];
//        self.menuOne = [tempDic objectForKey:@"url"];
//        self.webViewUrlOne = [dic objectForKey:@"url"];
//        NSDictionary *dic2 = [array objectAtIndex:1];
//        NSDictionary *tempDic2 = [dic2 objectForKey:@"pic"];
//        self.menuTwo = [tempDic2 objectForKey:@"url"];
//        self.webViewUrlTwo = [dic2 objectForKey:@"url"];
        
//        NSDictionary *tempDicOne = [dic objectForKey:@"detail"];
//        self.detailApiOne = [tempDicOne objectForKey:@"api"];
//        NSDictionary *tempDicTwo = [dic2 objectForKey:@"detail"];
//        self.detailApiTwo = [tempDicTwo objectForKey:@"api"];
        
        if (array.count == 2) {
            
            NSDictionary *dic = [array objectAtIndex:0];
            NSDictionary *tempDic = [dic objectForKey:@"pic"];
            self.menuOne = [tempDic objectForKey:@"url"];
            self.webViewUrlOne = [dic objectForKey:@"url"];
            NSDictionary *dic2 = [array objectAtIndex:1];
            NSDictionary *tempDic2 = [dic2 objectForKey:@"pic"];
            self.menuTwo = [tempDic2 objectForKey:@"url"];
            self.webViewUrlTwo = [dic2 objectForKey:@"url"];
            
            NSDictionary *tempDicOne = [dic objectForKey:@"detail"];
            self.detailApiOne = [tempDicOne objectForKey:@"api"];
            NSDictionary *tempDicTwo = [dic2 objectForKey:@"detail"];
            self.detailApiTwo = [tempDicTwo objectForKey:@"api"];

        } else {
            
            NSDictionary *dic = [array objectAtIndex:0];
            NSDictionary *tempDic = [dic objectForKey:@"pic"];
            self.menuOne = [tempDic objectForKey:@"url"];
            self.webViewUrlOne = [dic objectForKey:@"url"];
            
            NSDictionary *tempDicOne = [dic objectForKey:@"detail"];
            self.detailApiOne = [tempDicOne objectForKey:@"api"];
        }
//        self.menuTwo = [array objectAtIndex:1];
        
        
        
    } else if ([key isEqualToString:@"like"]) {
        self.likeCount = [[value objectForKey:@"likeCount"] stringValue];
    }
    //    else if ([key isEqualToString:@"user"]) {
//        
//        self.v = [value objectForKey:@"v"];
//    }
}


@end
